/*
 * RecMarker.java
 *
 * Created on 30 April 2007, 10:55
 *
 */

package pl.krakow.ae.knp.wikiboard.gui.tools.markers;

import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
import java.awt.geom.Point2D;
import pl.krakow.ae.knp.wikiboard.gui.board.Board;
import pl.krakow.ae.knp.wikiboard.gui.board.BoardEvent;
import pl.krakow.ae.knp.wikiboard.gui.drawables.Drawable;
import pl.krakow.ae.knp.wikiboard.gui.drawables.Rectangle;

/**
 * Rectangle Marker Class
 * @author Slawek Wojcicki
 */
public class RectMarker extends FigureMarker
{
    
    public void mousePressed(MouseEvent event, Graphics2D g)
    {
        drawable = new Rectangle(event.getPoint(), Board.getFgColor());
        drawable.draw(g, true);
    }
    
    public void mouseDragged(MouseEvent event, Graphics2D g)
    {
        drawable.draw(g, true);
        drawable.drag(event);
        drawable.draw(g, true);
    }
    
    public void mouseReleased(MouseEvent event, Graphics2D g)
    {
        BoardEvent e = createEvent();
        processBoardEvent(e);
    }
    
}
